using System;
using System.Collections.Generic;
using System.Text;

namespace LumiSoft.Net.Mime.vCard
{
    /// <summary>
    /// vCard structure item.
    /// </summary>
    public class Item
    {
        private string m_Name       = "";
        private string m_Parameters = "";
        private string m_Value      = "";

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="name">Item name.</param>
        /// <param name="parameters">Item parameters.</param>
        /// <param name="value">Item value.</param>
        public Item(string name,string parameters,string value)
        {
            m_Name       = name;
            m_Parameters = parameters;
            m_Value      = value;
        }


        #region internal method ToItemString

        /// <summary>
        /// Converts item to vCal item string.
        /// </summary>
        /// <returns></returns>
        internal string ToItemString()
        {
            if(m_Parameters.Length > 0){
                return m_Name + ";" + m_Parameters + ":" + MimeUtils.FoldData(m_Value);
            }
            else{
                return m_Name + ":" + MimeUtils.FoldData(m_Value);
            }
        }

        #endregion


        #region Properties Implementation

        /// <summary>
        /// Gest item name.
        /// </summary>
        public string Name
        {
            get{ return m_Name; }
        }

        /// <summary>
        /// Gets or sets item parameters.
        /// </summary>
        public string ParametersString
        {
            get{ return m_Parameters; }

            set{ m_Parameters = value; }
        }

        /// <summary>
        /// Gets or sets item value.
        /// </summary>
        public string Value
        {
            get{ return m_Value; }

            set{ m_Value = value; }
        }

        #endregion

    }
}
